package com.ym.medical.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ym.core.utils.tkmybatis.BaseSVImpl;
import com.ym.medical.dao.PersonalTransactionOrderDao;
import com.ym.medical.domain.entity.PersonalTransactionOrderEntity;
import com.ym.medical.domain.param.TdRecordExampleParam;
import com.ym.medical.domain.vo.PerTransfTdRecordVO;
import com.ym.medical.service.IAccountSV;
import com.ym.medical.service.IPersonalTransactionOrderSV;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * ComputerName:LAPTOP-I6GKDIFQ
 * Author:admin
 * Date: 2019-08-12
 * Time: 13:52:46
 * 服务实现类
 */
@Service
@Transactional( rollbackFor = Exception.class)
public class PersonalTransactionOrderSVImpl extends BaseSVImpl<PersonalTransactionOrderEntity,PersonalTransactionOrderDao> implements IPersonalTransactionOrderSV {

    @Override
    public PersonalTransactionOrderEntity selectByIoNum(String outTradeNo) {
        List<PersonalTransactionOrderEntity> personalTransactionOrders = this.selectList(PersonalTransactionOrderEntity.builder().ioNum(outTradeNo).build());
        return (personalTransactionOrders.isEmpty())?null:personalTransactionOrders.get(0);
    }

    @Override
    public PageInfo<PerTransfTdRecordVO> listPersonalTransaction(TdRecordExampleParam tdRecordExampleVO, int pageNo, int limit) {
        PageHelper.startPage(pageNo,limit);
        return new PageInfo<PerTransfTdRecordVO>(mapper.listPersonalTransaction(tdRecordExampleVO));
    }
}
